package com.wtf.springbootblog.controller;


import com.wtf.springbootblog.common.lang.Result;
import com.wtf.springbootblog.pojo.MUser;
import com.wtf.springbootblog.service.IMUserService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lifuqiang
 * @since 2021-12-10
 */
@Controller
@RequestMapping("/user")
public class MUserController {
       @Autowired
       IMUserService userService;


       //@RequiresAuthentication
       @GetMapping("/index")
       @ResponseBody
       public Result index(){
              MUser byId = userService.getById(1L);
              return Result.succ(byId);

       }


       @PostMapping("/save")
       @ResponseBody
       public Object testUser(@Validated @RequestBody MUser user) {
              return user.toString();
       }


}
